package org.perla.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 */
@Embeddable
public class AttitudePK implements Serializable {
    @Basic(optional = false)
    @Column(name = "ID_NODO")
    private String idNodo;
    @Basic(optional = false)
    @Column(name = "TIMESTAMP")
    private long timestamp;
    @Basic(optional = false)
    @Column(name = "ID_SENSORE")
    private String idSensore;

    public AttitudePK() {
    }

    public AttitudePK(String idNodo, long timestamp, String idSensore) {
        this.idNodo = idNodo;
        this.timestamp = timestamp;
        this.idSensore = idSensore;
    }

    public String getIdNodo() {
        return idNodo;
    }

    public void setIdNodo(String idNodo) {
        this.idNodo = idNodo;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getIdSensore() {
        return idSensore;
    }

    public void setIdSensore(String idSensore) {
        this.idSensore = idSensore;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idNodo != null ? idNodo.hashCode() : 0);
        hash += (int) timestamp;
        hash += (idSensore != null ? idSensore.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AttitudePK)) {
            return false;
        }
        AttitudePK other = (AttitudePK) object;
        if ((this.idNodo == null && other.idNodo != null) || (this.idNodo != null && !this.idNodo.equals(other.idNodo))) {
            return false;
        }
        if (this.timestamp != other.timestamp) {
            return false;
        }
        if ((this.idSensore == null && other.idSensore != null) || (this.idSensore != null && !this.idSensore.equals(other.idSensore))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.perla.entities.AttitudePK[idNodo=" + idNodo + ", timestamp=" + timestamp + ", idSensore=" + idSensore + "]";
    }

}
